<template>
  <view class="work-container">
    <!-- 轮播图 -->
    <uni-swiper-dot class="uni-swiper-dot-box" :info="data" :current="current" field="content">
      <swiper class="swiper-box" :current="swiperDotIndex" @change="changeSwiper">
        <swiper-item v-for="(item, index) in data" :key="index">
          <view class="swiper-item">
            <image :src="item.image" mode="aspectFill" :draggable="false"/>
          </view>
        </swiper-item>
      </swiper>
    </uni-swiper-dot>


    <uni-grid :column="2" :showBorder="false" :square="false">
      <uni-grid-item>
        <view class="work" @click="deviceMonitor()">
          <image :src="static_url+'work/jiankong.png'" class="workPic"></image>
          <text class="text">织机监控</text>
        </view>
      </uni-grid-item>
     <uni-grid-item v-if="userType==='1'">
       <view class="work" @click="clothTypeDetails()">
         <image :src="static_url+'work/buzhong.png'" class="workPic"></image>
         <text class="text">布种资料</text>
       </view>
     </uni-grid-item>
      <uni-grid-item v-if="userType==='1'">
        <view class="work" @click="changeClothDetails()">
          <image :src="static_url+'work/genghuan.png'" class="workPic"></image>
          <text class="text">更换布种</text>
        </view>
      </uni-grid-item>
      <uni-grid-item>
        <view class="work" @click="recordInfo()">
          <image :src="static_url+'work/jilu.png'" class="workPic"></image>
          <text class="text">运行记录</text>
        </view>
      </uni-grid-item>
	  <uni-grid-item>
	    <view class="work" @click="troubleInfo()">
	      <image :src="static_url+'work/trouble.png'" class="workPic"></image>
	      <text class="text">故障记录</text>
	    </view>
	  </uni-grid-item>
      <uni-grid-item v-if="userType==='2' || userType==='16'">
        <view class="work" @click="toSalary()">
          <image :src="static_url+'work/gongz.png'" class="workPic"></image>
          <text class="text">工资查询</text>
        </view>
      </uni-grid-item>
	  <uni-grid-item v-if="userType==='1'">
	    <view class="work"  @click="toSalaryManage()">
	      <image :src="static_url+'work/gongz.png'" class="workPic"></image>
	      <text class="text">工资查询</text>
	    </view>
	  </uni-grid-item>
      <uni-grid-item>
        <view class="work" @click="changeGrid()">
          <image :src="static_url+'work/jindu.png'" class="workPic"></image>
          <text class="text">进度查询</text>
        </view>
      </uni-grid-item>
      <uni-grid-item v-if="userType==='1'">
        <view class="work" @click="facList()">
          <image :src="static_url+'work/factory.png'" class="workPic"></image>
          <text class="text">工厂设置</text>
        </view>
      </uni-grid-item>
      <uni-grid-item v-if="userType==='1'">
        <view class="work" @click="workerDetails()">
          <image :src="static_url+'work/yuangong.png'" class="workPic"></image>
          <text class="text">员工管理</text>
        </view>
      </uni-grid-item>
      <uni-grid-item v-if="userType==='1'">
        <view class="work" @click="companiesDetails()">
          <image :src="static_url+'work/kehu.png'" class="workPic"></image>
          <text class="text">客户管理</text>
        </view>
      </uni-grid-item>
	  <uni-grid-item v-if="userType==='1'">
	    <view class="work" @click="toBindDetails()">
	      <image :src="static_url+'work/perBind.png'" class="workPic"></image>
	      <text class="text">员工绑卡</text>
	    </view>
	  </uni-grid-item>
    </uni-grid>
	<watermark :text="companyName"></watermark>
  </view>
</template>

<script>
  import watermark from 'components/warter/watermark.vue'
  export default {
	components:{watermark},
    data() {
      return {
		companyName:this.$store.getters.name,
		static_url: getApp().globalData.config.appInfo.static_image_url,
        userType: '',
        current: 0,
        swiperDotIndex: 0,
        data: [
          {
            image: getApp().globalData.config.appInfo.static_image_url+'banner/yuhang1.png'
          }
        ]
      }
    },
    mounted() {
      this.userType = this.$store.getters.userType
    },
    methods: {
      // clickBannerItem(item) {
      //   console.info(item)
      // },
      changeSwiper(e) {
        this.current = e.detail.current
      },
      changeGrid(e) {
        // this.$modal.showToast('模块建设中~')
		this.$tab.navigateTo('/pagesA/task/temp')
      },
      //跳转至员工详情页
      workerDetails() {
        this.$tab.navigateTo('/pagesA/work/emp/index')
      },
      companiesDetails() {
        this.$tab.navigateTo('/pagesA/work/companies/index')
      },
      //织机监控
      deviceMonitor() {
        this.$tab.navigateTo('/pagesA/work/device/index')
      },
      clothTypeDetails() {
        this.$tab.navigateTo('/pagesA/cloth/index')
      },
      changeClothDetails() {
        this.$tab.navigateTo('/pagesA/cloth/change')
      },
	  recordInfo(){
		 this.$tab.navigateTo('/pagesA/record/index')
	  },
	  troubleInfo(){
		  this.$tab.navigateTo('/pagesA/trouble/index')
	  },
      //厂区列表
      facList() {
        this.$tab.navigateTo('/pagesA/factoryabout/facset')
      },
	  toSalary(){
		this.$tab.navigateTo('/pagesA/work/salary/index')
	  },
	  toSalaryManage(){
	  		this.$tab.navigateTo('/pagesA/work/salary/salary')
	  },
	  //跳转至员工绑卡页面
	  toBindDetails(){
		  this.$tab.navigateTo('/pagesA/work/emp/searchDev')
	  },
    }
  }
</script>

<style lang="scss">
	.workPic{
		vertical-align:middle;
		width: 50rpx;
		height: 50rpx;
	}
	
  /* #ifndef APP-NVUE */
  page {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    //background-color: #fff;
    min-height: 100%;
    height: auto;
  }

  view {
    font-size: 14px;
    line-height: inherit;
  }

  /* #endif */

  .text {
    text-align: center;
    font-size: 30rpx;
    margin-left: 10rpx;
  }
  
   // .uni-grid-item{
	  //  height: 250rpx;
	  //  line-height: 250rpx;
	  //  border-radius: 8%;
   // }

  .uni-margin-wrap {
    width: 690rpx;
    width: 100%;
    ;
  }

  .swiper {
    height: 300rpx;
  }

  .swiper-box {
    height: 150px;
  }

  .swiper-item {
    /* #ifndef APP-NVUE */
    display: flex;
    /* #endif */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    height: 300rpx;
    line-height: 300rpx;
  }

  @media screen and (min-width: 500px) {
    .uni-swiper-dot-box {
      width: 400px;
      /* #ifndef APP-NVUE */
      margin: 0 auto;
      /* #endif */
      margin-top: 8px;
    }

    .image {
      width: 100%;
    }
  }

  .work {
    padding: 20rpx;
    background-color: #fff;
    margin: 20rpx 30rpx;
    align-items: center;
    text-align: center;
    border: #fff 30rpx solid;
    border-radius: 30rpx;
  }
</style>
